<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('比赛编排')" />
    <th:block th:include="include :: datetimepicker-css" />
    <style>
        .start-time{
            width: 200px;
        }
        #session_players{
            width: 100px;
        }
        #session_time{
            width: 100px;
        }
        td{
            max-width: 200px;
            white-space: nowrap;
            text-overflow: ellipsis;
            overflow: hidden;
        }
    </style>
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="formId">
                    <div class="select-list">
                        <ul>
                            <li>
                                <p>场地：</p>
                                <select onchange="$.table.search();" name="placeId" id="select2_place" class="form-control">
                                    <option value="">全部</option>
                                    <option th:each="place : ${placeList}" th:text="${place.name}" th:value="${place.id}"></option>
                                </select>
                            </li>
                            <li>
                                <p>姓名：</p>
                                <input type="text" autocomplete="off" name="playerName"/>
                            </li>
                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>

            <div class="btn-group-sm" id="toolbar" role="group">
                <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="js:register:export">
                    <i class="fa fa-download"></i> 导出
                </a>
                <a class="btn btn-success" onclick="sendToRefreshRegisterList()" shiro:hasPermission="rec:register:edit">
                    <i class="fa fa-refresh"></i> 刷新推送列表
                </a>
            </div>

            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('js:register:edit')}]];
        var removeFlag = [[${@permission.hasPermi('js:register:remove')}]];
        var prefix = ctx + "js/register";

        $(function() {
            var options = {
                url: prefix + "/listArrange",
                updateUrl: prefix + "/editArrange/{id}",
                exportUrl: prefix + "/exportArrange",
                modalName: "编排",
                columns: [{
                    checkbox: true,
                    visible: false
                },
                {
                    field : 'id',
                    title : 'ID',
                    visible: false
                },
                {
                    field : 'itemName',
                    title : '小项'
                },
                {
                    field : 'playerName',
                    title : '选手'
                },
                {
                    field : 'playerIdcard',
                    title : '身份证',
                    visible: false
                },
                {
                    field : 'placeName',
                    title : '场地'
                },
                {
                    field : 'session',
                    title : '轮次'
                },
                {
                    field : 'odr',
                    title : '序号'
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                        return actions.join('');
                    }
                }]
            };
            $.table.init(options);
        });

        function sendToRefreshRegisterList() {
            $.get(prefix + "/sendToRefreshRegisterList", { }, function (result) {
                if (result.code == web_status.SUCCESS) {
                    $.modal.msg("发送成功");
                } else {
                    $.modal.alertWarning("发送失败");
                }
            });
        }

    </script>
</body>

</html>
</html>